package com.hrsaas.ext.spider.test.domain;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.hrsaas.ext.spider.util.JsonUtils;

/**
 * <p>
 * 功能：响应数据解析
 * <p>
 * @author wangxiaoliang@kanzhun.com
 *
 * 2018年8月8日
 */
public class LGJsonBean {
	
	private int state;
	private String message;
	private Content content;

	public void setState(int state) {
		this.state = state;
	}

	public int getState() {
		return state;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getMessage() {
		return message;
	}

	public void setContent(Content content) {
		this.content = content;
	}

	public Content getContent() {
		return content;
	}
	
	/**
	 * 获取请求id列表
	 * @return
	 */
	public List<String> getResumeUrls() {
		List<Rows> rows = content.getRows();
		if (rows != null && rows.size() != 0) {
			List<String> result = new ArrayList<String>(rows.size());
			for (Rows row : rows) {
				result.add(
						new StringBuilder("https://easy.lagou.com/resume/order/").
						append(row.getId()).
						append(".json").
						toString());
			}
			return result;
		}
		return Collections.EMPTY_LIST;
	}

	public int getTotalPageCount() {
		return content.getData().getTotalPageCount();
	}
	
	public int getPagesize() {
		return content.getData().getPageSize();
	}

	@Override
	public String toString() {
		return "LGJsonBean [state=" + state + ", message=" + message + ", content=" + content + "]";
	}
	
}

class Content {

	private Data data;
	private List<Rows> rows;

	public void setData(Data data) {
		this.data = data;
	}

	public Data getData() {
		return data;
	}

	public void setRows(List<Rows> rows) {
		this.rows = rows;
	}

	public List<Rows> getRows() {
		return rows;
	}

	@Override
	public String toString() {
		return "Content [data=" + data + ", rows=" + rows + "]";
	}
	
}

class Data {

	private StageNum stageNum;
	private int pageSize;
	private int totalPageCount;
	private int totalCount;

	public void setStageNum(StageNum stageNum) {
		this.stageNum = stageNum;
	}

	public StageNum getStageNum() {
		return stageNum;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}

	public int getTotalPageCount() {
		return totalPageCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getTotalCount() {
		return totalCount;
	}

	@Override
	public String toString() {
		return "Data [stageNum=" + stageNum + ", pageSize=" + pageSize + ", totalPageCount=" + totalPageCount
				+ ", totalCount=" + totalCount + "]";
	}
	
}

class StageNum {

	private int newCount;
	private int linkCount;
	private int interViewCount;
	private int luyongCount;
	private int employedAndObsoleteCount;

	public void setNewCount(int newCount) {
		this.newCount = newCount;
	}

	public int getNewCount() {
		return newCount;
	}

	public void setLinkCount(int linkCount) {
		this.linkCount = linkCount;
	}

	public int getLinkCount() {
		return linkCount;
	}

	public void setInterViewCount(int interViewCount) {
		this.interViewCount = interViewCount;
	}

	public int getInterViewCount() {
		return interViewCount;
	}

	public void setLuyongCount(int luyongCount) {
		this.luyongCount = luyongCount;
	}

	public int getLuyongCount() {
		return luyongCount;
	}

	public void setEmployedAndObsoleteCount(int employedAndObsoleteCount) {
		this.employedAndObsoleteCount = employedAndObsoleteCount;
	}

	public int getEmployedAndObsoleteCount() {
		return employedAndObsoleteCount;
	}

	@Override
	public String toString() {
		return "StageNum [newCount=" + newCount + ", linkCount=" + linkCount + ", interViewCount="
				+ interViewCount + ", luyongCount=" + luyongCount + ", employedAndObsoleteCount="
				+ employedAndObsoleteCount + "]";
	}
	
}

class Rows {
	
	private String lastPositionName;
	private String haveInterview;
	private String unReadMessageNum;
	private String id;
	private String companyId;
	private String candidateName;
	private String phone;
	private String email;
	private String sex;
	private String lastCompanyName;
	private String lastSchoolName;
	private String workYear;
	private String portrait;
	private String createTime;
	private String positionId;
	private String resumeOwnerId;
	private String positionName;
	private String deliverTime;
	private String channelType;
	private String channelName;
	private String stage;
	private String subStage;
	private String stageEnterTime;
	private String deliverDays;
	private String educational;
	private String userId;
	private String nickName;
	private String userPortrait;
	private String deliverTimeStr;
	private String channelId;
	private String deliverTimeAddFiveStr;
	
	public String getLastPositionName() {
		return lastPositionName;
	}
	
	public void setLastPositionName(String lastPositionName) {
		this.lastPositionName = lastPositionName;
	}
	
	public String getHaveInterview() {
		return haveInterview;
	}
	
	public void setHaveInterview(String haveInterview) {
		this.haveInterview = haveInterview;
	}
	
	public String getUnReadMessageNum() {
		return unReadMessageNum;
	}
	
	public void setUnReadMessageNum(String unReadMessageNum) {
		this.unReadMessageNum = unReadMessageNum;
	}
	
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getCompanyId() {
		return companyId;
	}
	
	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}
	
	public String getCandidateName() {
		return candidateName;
	}
	
	public void setCandidateName(String candidateName) {
		this.candidateName = candidateName;
	}
	
	public String getPhone() {
		return phone;
	}
	
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	public String getEmail() {
		return email;
	}
	
	public void setEmail(String email) {
		this.email = email;
	}
	
	public String getSex() {
		return sex;
	}
	
	public void setSex(String sex) {
		this.sex = sex;
	}
	
	public String getLastCompanyName() {
		return lastCompanyName;
	}
	
	public void setLastCompanyName(String lastCompanyName) {
		this.lastCompanyName = lastCompanyName;
	}
	
	public String getLastSchoolName() {
		return lastSchoolName;
	}
	
	public void setLastSchoolName(String lastSchoolName) {
		this.lastSchoolName = lastSchoolName;
	}
	
	public String getWorkYear() {
		return workYear;
	}
	
	public void setWorkYear(String workYear) {
		this.workYear = workYear;
	}
	
	public String getPortrait() {
		return portrait;
	}
	
	public void setPortrait(String portrait) {
		this.portrait = portrait;
	}
	
	public String getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}
	
	public String getPositionId() {
		return positionId;
	}
	
	public void setPositionId(String positionId) {
		this.positionId = positionId;
	}
	
	public String getResumeOwnerId() {
		return resumeOwnerId;
	}
	
	public void setResumeOwnerId(String resumeOwnerId) {
		this.resumeOwnerId = resumeOwnerId;
	}
	
	public String getPositionName() {
		return positionName;
	}
	
	public void setPositionName(String positionName) {
		this.positionName = positionName;
	}
	
	public String getDeliverTime() {
		return deliverTime;
	}
	
	public void setDeliverTime(String deliverTime) {
		this.deliverTime = deliverTime;
	}
	
	public String getChannelType() {
		return channelType;
	}
	
	public void setChannelType(String channelType) {
		this.channelType = channelType;
	}
	
	public String getChannelName() {
		return channelName;
	}
	
	public void setChannelName(String channelName) {
		this.channelName = channelName;
	}
	
	public String getStage() {
		return stage;
	}
	
	public void setStage(String stage) {
		this.stage = stage;
	}
	
	public String getSubStage() {
		return subStage;
	}
	
	public void setSubStage(String subStage) {
		this.subStage = subStage;
	}
	
	public String getStageEnterTime() {
		return stageEnterTime;
	}
	
	public void setStageEnterTime(String stageEnterTime) {
		this.stageEnterTime = stageEnterTime;
	}
	
	public String getDeliverDays() {
		return deliverDays;
	}
	
	public void setDeliverDays(String deliverDays) {
		this.deliverDays = deliverDays;
	}
	
	public String getEducational() {
		return educational;
	}
	
	public void setEducational(String educational) {
		this.educational = educational;
	}
	
	public String getUserId() {
		return userId;
	}
	
	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	public String getNickName() {
		return nickName;
	}
	
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	
	public String getUserPortrait() {
		return userPortrait;
	}
	
	public void setUserPortrait(String userPortrait) {
		this.userPortrait = userPortrait;
	}
	
	public String getDeliverTimeStr() {
		return deliverTimeStr;
	}
	
	public void setDeliverTimeStr(String deliverTimeStr) {
		this.deliverTimeStr = deliverTimeStr;
	}
	
	public String getChannelId() {
		return channelId;
	}
	
	public void setChannelId(String channelId) {
		this.channelId = channelId;
	}
	
	public String getDeliverTimeAddFiveStr() {
		return deliverTimeAddFiveStr;
	}
	
	public void setDeliverTimeAddFiveStr(String deliverTimeAddFiveStr) {
		this.deliverTimeAddFiveStr = deliverTimeAddFiveStr;
	}

	@Override
	public String toString() {
		return "Rows [lastPositionName=" + lastPositionName + ", haveInterview=" + haveInterview
				+ ", unReadMessageNum=" + unReadMessageNum + ", id=" + id + ", companyId=" + companyId
				+ ", candidateName=" + candidateName + ", phone=" + phone + ", email=" + email
				+ ", sex=" + sex + ", lastCompanyName=" + lastCompanyName + ", lastSchoolName="
				+ lastSchoolName + ", workYear=" + workYear + ", portrait=" + portrait + ", createTime="
				+ createTime + ", positionId=" + positionId + ", resumeOwnerId=" + resumeOwnerId
				+ ", positionName=" + positionName + ", deliverTime=" + deliverTime + ", channelType="
				+ channelType + ", channelName=" + channelName + ", stage=" + stage + ", subStage="
				+ subStage + ", stageEnterTime=" + stageEnterTime + ", deliverDays=" + deliverDays
				+ ", educational=" + educational + ", userId=" + userId + ", nickName=" + nickName
				+ ", userPortrait=" + userPortrait + ", deliverTimeStr=" + deliverTimeStr
				+ ", channelId=" + channelId + ", deliverTimeAddFiveStr=" + deliverTimeAddFiveStr + "]";
	}
	
}